package com.titar.robot.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.titar.robot.RobotApp;

public class NetUtils {
    public static boolean isNetConnected(){
        if (RobotApp.getContext() != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) RobotApp.getContext()
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
            if (mNetworkInfo != null) {
                return mNetworkInfo.isAvailable();
            }
        }
        return false;
    }
}
